import React, {Component} from 'react'
import {Route, Redirect} from 'react-router-dom'


import Memo from './Memo/Memo'
import Info from './Info/Info'

import './user.scss'

class User extends Component {
  constructor (props) {
    super(props)
  }
  linkTo (url) {
    this.props.history.push(`/user${url}`)
  }
  render () {
    const {url} = this.props.match
    return (
      <div>
        <p>用户信息</p>
        <ul className="nav">
          <li onClick={() => this.linkTo('/memo')}>备忘录</li>
          <li onClick={() => this.linkTo('/info')}>用户信息</li>
        </ul>
        <Route path={`${url}/memo`} component={Memo} />
        <Route path={`${url}/info`} component={Info} />
      </div>
    )
  }
}

export default User